﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace SynchronizationStudy
{
    class AutoResetEventTest
    {
        public static void Test()
        {
            var are = new AutoResetEvent(false);

            Task.Run(() => {
                are.WaitOne();
                Console.WriteLine("A");
            });

            Task.Run(() =>
            {
                are.WaitOne();
                Console.WriteLine("B");
            });

            are.Set();
            Thread.Sleep(100);
            are.Set();

            Console.ReadLine();
        }
    }
}
